<%@ page import="java.time.Instant" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!-- Modal -->
<dialog id="authModal" class="modal modal-bottom sm:modal-middle">
    <div class="modal-box max-w-lg">
        <h3 class="text-lg font-bold text-center select-none mb-4">用户登录</h3>
        <form id="authForm" class="flex flex-col space-y-2">
            <div class="form-control">
                <label class="input input-bordered flex items-center gap-2">
                    <svg xmlns="http://www.w3.org/2000/svg"
                         viewBox="0 0 16 16"
                         fill="currentColor"
                         class="h-4 w-4 opacity-70"
                    >
                        <path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM12.735 14c.618 0 1.093-.561.872-1.139a6.002 6.002 0 0 0-11.215 0c-.22.578.254 1.139.872 1.139h9.47Z"></path>
                    </svg>
                    <input type="text" id="modal_login_username" class="grow h-12" placeholder="用户名" required/>
                </label>
            </div>
            <div class="form-control">
                <label class="input input-bordered flex items-center gap-2">
                    <svg xmlns="http://www.w3.org/2000/svg"
                         viewBox="0 0 16 16"
                         fill="currentColor"
                         class="h-4 w-4 opacity-70"
                    >
                        <path fill-rule="evenodd"
                              d="M14 6a4 4 0 0 1-4.899 3.899l-1.955 1.955a.5.5 0 0 1-.353.146H5v1.5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-2.293a.5.5 0 0 1 .146-.353l3.955-3.955A4 4 0 1 1 14 6Zm-4-2a.75.75 0 0 0 0 1.5.5.5 0 0 1 .5.5.75.75 0 0 0 1.5 0 2 2 0 0 0-2-2Z"
                              clip-rule="evenodd"></path>
                    </svg>
                    <input type="password" id="modal_login_password" class="grow h-12" placeholder="密码" required/>
                </label>
            </div>
            <div class="flex justify-between items-center">
                <div class="form-control w-2/3">
                    <label class="input input-bordered flex items-center gap-2">
                        <svg xmlns="http://www.w3.org/2000/svg"
                             viewBox="0 0 16 16"
                             fill="currentColor"
                             class="h-4 w-4 opacity-70"
                        >
                            <path d="M4.5 3.5h7a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2Zm.5 2v7m6-7v7"></path>
                        </svg>
                        <input type="text" id="modal_login_captcha" class="grow h-12" placeholder="验证码" required/>
                    </label>
                </div>
                <img id="modal_login_captchaImage" src="/api/auth/checkCode" alt="验证码" class="cursor-pointer grow h-12 w-1/3"
                />
            </div>
            <div class="modal-action w-full">
                <button form="authForm" class="btn btn-primary mx-auto w-4/5">
                    立即登录
                </button>
            </div>
        </form>
        <form method="dialog">
            <button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button>
        </form>
    </div>
</dialog>